﻿<%@ Page Language="C#" AutoEventWireup="true" CodeBehind="List.aspx.cs" Inherits="Web.Admin.Page.List" %>
<%@ Import Namespace="System" %>
<%@ Import Namespace="System.Collections" %>
<%@ Import Namespace="System.Collections.Generic" %>
<%@ Import Namespace="System.IO" %>
<%@ Import Namespace="System.Linq" %>
<%@ Import Namespace="System.Web" %>
<%@ Import Namespace="System.Web.UI" %>
<%@ Import Namespace="System.Web.UI.WebControls" %>

<!DOCTYPE html>

<%="<!--[if IE 8]> <html class=\"ie8 no-js\"> <![endif]-->"%>
<%="<!--[if IE 9]> <html class=\"ie9 no-js\"> <![endif]-->"%>
<%="<!--[if !IE]><!-->"%>
<html>
<%="<!--<![endif]-->"%>
<!-- BEGIN HEAD -->

<head>
    <meta charset="utf-8" />
    <title><%=Evan.Common.CommFun.GetAppSetting("AdminTitle") %> - 后台管理系统</title>
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta content="width=device-width, initial-scale=1" name="viewport" />
    <!-- #include file="../include/com_res_css.inc" -->
</head>
<!-- END HEAD -->

<body class="page-header-fixed page-sidebar-closed-hide-logo page-content-white">
    <!-- BEGIN HEADER -->

    <!-- #include file="../include/top_bar.inc" -->

    <!-- END HEADER -->
    <!-- BEGIN HEADER & CONTENT DIVIDER -->
    <div class="clearfix"></div>
    <!-- END HEADER & CONTENT DIVIDER -->
    <!-- BEGIN CONTAINER -->
    <div class="page-container">
        <!-- BEGIN SIDEBAR -->

        <!-- #include file="../include/left_menu.inc" -->

        <!-- END SIDEBAR -->
        <!-- BEGIN CONTENT -->
        <div class="page-content-wrapper">
            <!-- BEGIN CONTENT BODY -->
            <div class="page-content">
                <!-- BEGIN PAGE HEADER-->
                <!-- BEGIN THEME PANEL -->
                <!-- #include file="../include/theme_panel.inc" -->
                <!-- END THEME PANEL -->
                
                <!-- BEGIN PAGE TITLE-->
                <h3 class="page-title"><a href="../Page_Channel/Edit.aspx?action=editChannel&t=Channel&id=<%=ClassId %>"><%=CurChannel.Title %></a></h3>
                <p>
                    <% if (Evan.Member.Administrator.HasRole(1, ClassId.ToString(), "", "add")){ %>
                    <% if (TableName.ToLower() != "FeedBack".ToLower()){%>
                    <div class="btn-group btn-group-solid page-control">
                        <%if(ClassId != 118){ %>
                        <a class="btn default" href="javascript:AddClick();"><i class="fa fa-plus"></i>&nbsp;&nbsp;&nbsp;<span>增加内容</span></a>
                        <%} %>
                        <%-- <%if (IsViewEdit(CurChannel.EnTitle, CurChannel.PageType)){ %>
                            <a class="btn default" href="<%=CurChannel.WebPath %>add/index.html" target="_blank"><i class="fa fa-plus"></i>&nbsp;&nbsp;&nbsp;<span>可视化增加</span></a>
                        <%} %>--%>

                        <%if (ClassId == 118)
                            { %>
                        <div class="input-group input-icon left" style="width: 500px;">
                            <input name="filesrc_FilePath" placeholder="请选择上传文件" class="input-error form-control filesrc" type="text" value="">
                            <i class="fa fa-file" style="color:#555;font-size:14px;"></i>
                            <span class="input-group-addon btn default btn-file">
                                <span class="fileinput-new"> 选择文件 </span>
                                <input type="file" class="FilePath" name="fileinput_FilePath" field="FilePath" field_type="fileupload" data-value="">
                            </span>
                            <a class="input-group-addon btn red FilePath_Import" >导入</a> 
                        </div>
                        <%} %>
                        
                    </div>
                    <% } %>
                    <%} %>
                    <%if (ClassId != 118)
                            { %>
                    <div class="btn-group btn-group-solid page-control">
                        <a class="btn default check-all" check="false" rel="check-one" href="javascript:;"><i class="fa fa-check"></i>&nbsp;&nbsp;&nbsp;<span>全选</span></a>
                        <% if(Evan.Member.Administrator.HasRole(1, ClassId.ToString(), "", "update")){ %>
                        <a class="btn default states_lock_select" href="javascript:;"><i class="fa fa-lock"></i>&nbsp;&nbsp;&nbsp;<span>锁定</span></a>
                        <a class="btn default states_unlock_select" href="javascript:;"><i class="fa fa-unlock"></i>&nbsp;&nbsp;&nbsp;<span>解锁</span></a>
                        <%} %>
                        <% if(Evan.Member.Administrator.HasRole(1, ClassId.ToString(), "", "delete")){ %>
                        <a class="btn default del_select" href="javascript:;"><i class="fa fa-remove"></i>&nbsp;&nbsp;&nbsp;<span>删除</span></a>
                        <%} %>
                    </div>
                    <%} %>

                    <% if(Evan.Member.Administrator.HasRole(1, ClassId.ToString(), "", "restore")){ %>
                      <%if (ClassId != 118)
                            { %>
                    <div class="btn-group btn-group-solid page-control">
                        <a class="btn default" href="javascript:JumpRecycle();"><i class="fa fa-trash"></i>&nbsp;&nbsp;&nbsp;<span>回收站</span></a>
                    </div>
                     <%} %>
                    <%} %>

                    <div class="btn-group btn-group-solid page-control">
                        <% if (GlobalConfigModel.Dev) { %>
                            <a class="btn default" href="javascript:AddField();"><i class="fa fa-bars"></i>&nbsp;&nbsp;&nbsp;<span>字段管理</span></a>       
                        <% } %>
                        <% if (!string.IsNullOrEmpty(CurChannel.WebPath)) { %>
                            <a class="btn default" href="<%=CurChannel.WebPath %>" target="_blank"><i class="fa fa-file-text-o"></i>&nbsp;&nbsp;&nbsp;<span>预览</span></a>
                        <%} %>
                    </div>

                    <div class="btn-group btn-group-solid page-control">
                        <% if (SiteConfig.WebMode==2) { %>
                            <% if(CurChannel.IsCreatePage==1){ %>
                                <a class="btn default" href="../Page_System/CreateStaticPages.aspx?classid=<%=ClassId %>"><i class="fa fa-file-code-o"></i>&nbsp;&nbsp;&nbsp;<span>生成静态页</span></a>       
                            <% } %>
                        <% } %>
                    </div>
                                    
                    <% if(CurChannel.IsExport==1){ %>                                                                                      
                    <div class="btn-group btn-group-solid page-control">
                        <div class="btn-group">
                                    
                            <a class="btn default dropdown-toggle" data-toggle="dropdown" href="javascript:;" aria-expanded="false">
                                <i class="fa fa-cloud-download"></i>&nbsp;&nbsp;&nbsp;导出Excel&nbsp;&nbsp;&nbsp;<i class="fa fa-angle-down"></i>
                            </a>
                            <ul class="dropdown-menu">
                                <li><a href="javascript:;" class="exportexcel" data-mode="curpage" data-classid="<%=ClassId %>" data-curpage="<%=CurPage %>" data-searchkey="<%=key %>"> 导出本页数据 </a></li>
                                <%if (!string.IsNullOrEmpty(Evan.Common.CommFun.GetQueryString("key"))) { %>
                                <li><a href="javascript:;" class="exportexcel" data-mode="curkey" data-classid="<%=ClassId %>" data-curpage="<%=CurPage %>" data-searchkey="<%=key %>"> 导出筛选出的数据 </a></li>      
                                <% } %>
                                <li><a href="javascript:;" class="exportexcel" data-mode="curclass" data-classid="<%=ClassId %>" data-curpage="<%=CurPage %>"> 导出本栏目数据 </a></li>
                                <li><a href="javascript:;"> 关闭 </a></li>
                            </ul>
                        </div>
                    </div>
                    <% } %>

                    <%--<div class="btn-group btn-group-solid page-control pull-right col-lg-3 col-md-3 col-xs-3">
                        <form id="manager-list-search" class="form-group">
                            <div class="input-group">
                                <input type="text" name="key" class="form-control" placeholder="搜索 , 仅支持标题搜索" value="<%=key %>">
                                <span class="input-group-btn">
                                    <button class="btn default" type="submit"><i class="fa fa-search"></i></button>
                                </span>
                            </div>
                            <!-- /input-group -->
                        </form>
                    </div>--%>
                    <div class="btn-group btn-group-solid page-control pull-right col-lg-3 col-md-3 col-xs-3">
                        <form id="manager-list-search" class="form-group">
                            <div class="input-group input-icon input-icon-sm">
                                <input type="text" name="key" class="form-control" style="padding:0 30px 0 12px;" placeholder="搜索 , 仅支持标题搜索" value="<%=key %>">
                                <i class="fa fa-remove remove-search tooltips" style="left:auto;right: 45px;float: right; top:2px; cursor:pointer" data-original-title="清除搜索关键字" ></i>
                                <span class="input-group-btn">
                                    <button class="btn default" type="submit"><i class="fa fa-search"></i></button>
                                </span>
                            </div>
                            <!-- /input-group -->
                        </form>
                    </div>

                </p>
                
                <!-- END PAGE TITLE-->
                <!-- END PAGE HEADER-->
                <!-- BEGIN PAGE CONTENT-->

                <div class="table-scrollable">
                    <table class="table table-striped table-bordered table-hover">
                        <thead>
                            <tr>
                                <th scope="col" class="manager_tab_center">选择</th>
                                <th scope="col">标题</th>

                                <th scope="col" class="manager_tab_center" style="width: 180px;">添加时间</th>
                                <th scope="col" class="manager_tab_center" style="width: 300px;">属性</th>
                                <th scope="col" class="manager_tab_center" style="width: 80px;">排序 <a href="javascript:;" style="color:#333" onclick="JumpEditChannelClick(<%=ClassId %>)" class="fa fa-question-circle tooltips" data-html="true" data-original-title="当前栏目的排序规则 : <br/>主排序 : <%= Evan.Common.SysComm.GetChannelOrderBy().First(k => k.Key == CurChannel.OrderBy.ToString()).Value  %><br/>副排序 : <%=Evan.Common.SysComm.GetChannelOrderBy().First(k => k.Key == CurChannel.SubOrderBy.ToString()).Value %><br/>单击去设置排序"></a></th>
                                <th scope="col" class="manager_tab_center" style="width: 300px;">操作</th>
                            </tr>
                        </thead>
                        <tbody>
                            <% foreach (var item in List.Item)
                               { %>
                            <tr>
                                <td class="manager_tab_check">
                                    <label class="mt-checkbox mt-checkbox-outline">
                                        <input type="checkbox" class="check-one" id="check-<%=item.Id %>" data-id="<%=item.Id %>" />
                                        <span></span>
                                    </label>
                                </td>
                                <td>
                                    <a data-id="<%=item.Id %>" onclick="EditClick(<%=item.Id %>)">
                                        <% if (Evan_BLL.GetCurChannelHasRelease(CurChannel)) { %>
                                            <b class="<%=DateTime.Now>Convert.ToDateTime(item.ReleaseTime)?"font-green":"font-red" %> tooltips" data-html="true" data-original-title="发布时间 : <%=item.ReleaseTime.ToString("yyyy-MM-dd HH:mm") %>"><%=DateTime.Now>Convert.ToDateTime(item.ReleaseTime)?"":"[未发布]" %></b>
                                        <% } %>
                                        <%=item.Title %>
                                    </a>
                                </td>

                                <td class="manager_tab_center"><%=item.AddTime.ToString("yyyy-MM-dd HH:mm:ss") %></td>
                                <td class="manager_tab_center">
                                    <a href="javascript:;" class="btn btn-xs <%=(item.States==0?"red":"default") %> states" data-tip-type="内容" data-id="<%=item.Id %>" data-title="<%=item.Title %>" data-states="<%=item.States %>">锁定 <i class="fa fa-lock"></i></a>
                                    <%if (IsHasQuickOpera(ClassId,"IsTop")) { %>
                                    <a href="javascript:;" class="btn btn-xs <%=(item.IsTop==1?"red":"default") %> istop" data-tip-type="内容" data-id="<%=item.Id %>" data-title="<%=item.Title %>" data-states="<%=item.IsTop %>">置顶 <i class="fa fa-upload"></i></a>
                                    <%} %>
                                    <%if (IsHasQuickOpera(ClassId,"IsIndex")) { %>
                                    <a href="javascript:;" class="btn btn-xs <%=(item.IsIndex==1?"red":"default") %> isindex" data-tip-type="内容" data-id="<%=item.Id %>" data-title="<%=item.Title %>" data-states="<%=item.IsIndex %>">首页 <i class="fa fa-home"></i></a>
                                    <%} %>
                                    <%if (IsHasQuickOpera(ClassId,"IsRed")) { %>
                                    <a href="javascript:;" class="btn btn-xs <%=(item.IsRed==1?"red":"default") %> isred" data-tip-type="内容" data-id="<%=item.Id %>" data-title="<%=item.Title %>" data-states="<%=item.IsRed %>">推荐 <i class="fa fa-thumbs-up"></i></a>
                                    <%} %>
                                    <%if (IsHasQuickOpera(ClassId,"IsHot")) { %>
                                    <a href="javascript:;" class="btn btn-xs <%=(item.IsHot==1?"red":"default") %> ishot" data-tip-type="内容" data-id="<%=item.Id %>" data-title="<%=item.Title %>" data-states="<%=item.IsHot %>">热门 <i class="fa fa-fire"></i></a>
                                    <%} %>
                                </td>
                                <th class="manager_tab_center">
                                    <input type="text" class="sortid_field" data-id="<%=item.Id %>" value="<%=item.SortId %>" /></th>
                                <td class="manager_tab_center">
                                    <div class="btn-group btn-group-xs btn-group-solid">
                                        <%if (CurChannel.IsVisualEdit==1) { %>
                                            <% string vEditLink = Evan_BLL.GetUrlByModel(item,CurChannel); %>
                                        <a class="btn green-meadow" href="<%=vEditLink.Trim() == "javascript:;" ? vEditLink:(vEditLink+"?vedit=true") %>"  <%=vEditLink.Trim() == "javascript:;" ? "":"target=\"_blank\"" %> >可视化编辑</a>
                                        <%} %>
                                        <button type="button" class="btn green" onclick="EditClick(<%=item.Id %>)">编辑</button>
                                        <% if(Evan.Member.Administrator.HasRole(1, ClassId.ToString(), "", "add")){ %>
                                          <% if (TableName.ToLower()!="FeedBack".ToLower())
                                               {%>
                                        <button type="button" class="btn blue copy" data-tip-type="内容" data-id="<%=item.Id %>" data-title="<%=item.Title %>">复制</button>
                                        <%} %>
                                        <%} %>

                                        <% if(Evan.Member.Administrator.HasRole(1, ClassId.ToString(), "", "delete")){ %>
                                        <button type="button" class="btn red del" data-tip-type="内容" data-id="<%=item.Id %>" data-title="<%=item.Title %>">删除</button>
                                        <%} %>
                                    </div>
                                </td>
                            </tr>
                            <% } %>
                        </tbody>
                    </table>
                </div>

                <div class="clearfix">
                    <div class="btn-toolbar pull-right pagebar"></div>
                </div>

                <!-- END PAGE CONTENT-->
            </div>
            <!-- END CONTENT BODY -->
        </div>
        <!-- END CONTENT -->

    </div>
    <!-- END CONTAINER -->
    <!-- #include file="../include/footer.inc" -->
    <!-- #include file="../include/com_res_js.inc" -->
</body>

<script type="text/javascript">
    $(function () {
        <%--laypage({
            cont: $(".pagebar"),
            pages: <%=List.PageCount%>, //总页数
            skip: false, //是否开启跳页
            groups: 10,
            //hash: 'fenye',
            curr: function () { //通过url获取当前页，也可以同上（pages）方式获取
                var page = location.search.match(/page=(\d+)/);
                return page ? page[1] : 1;
            }(),
            jump: function (e, first) { //触发分页后的回调
                if (!first) { //一定要加此判断，否则初始时会无限刷新
                    JumpPage(e.curr)
                    //location.href = '?page=' + e.curr;
                }
            }
        });--%>
        layui.laypage.render({
            elem: $(".pagebar"),
            count: <%=List.AllCount%>, //数据总数，从服务端得到
            limit: <%= PageSize %>,
            groups: 10,
            curr: function () { //通过url获取当前页，也可以同上（pages）方式获取
                var page = location.search.match(/page=(\d+)/);
                return page ? page[1] : 1;
            }(),
            prev: "上一页",
            next: "下一页",
            layout: ['count', 'prev', 'page', 'next'],
            jump: function (obj, first) {
                //console.log(obj.curr); //得到当前页，以便向服务端请求对应页的数据。
                //console.log(obj.limit); //得到每页显示的条数
                if (!first) { //一定要加此判断，否则初始时会无限刷新
                    JumpPage(obj.curr);
                }
            }
        });
    });
</script>
    <script>
                            $(".FilePath_Import").on("click",function(){
                                var FilePath=$("input[name=filesrc_FilePath]").val();
                                if(FilePath.length>0){
                                    $.ajax({
                                        type: "POST",
                                        url: '/Admin/ashx/ajax.ashx?action=filePathimport',
                                        data:{FilePath:FilePath},
                                        dataType: "json",
                                        success: function (data) {
                                            args[args.length - 1](true, data);
                                        },
                                        error: function (xhr, textStatus, responseText) {
                                            //console.log(xhr, textStatus, responseText);
                                        }
                                    });
                                }
                            })

                        </script>
</html>
